package com.example.administrator.picassodemo;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    private ListView mListView;
    private ArrayList<SunBean> listDatas;
    private SunAdapter mAdpater;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.listview_lv);
        mListView = (ListView) findViewById(R.id.listview_lv);
        listDatas = new ArrayList<>();
        initDatas();
        mAdpater = new SunAdapter(listDatas, this);
        mListView.setAdapter(mAdpater);
    }

    private void initDatas() {
        SunBean sunBean1 = new SunBean();
        sunBean1.setmTitle("梵高的眼泪1");
        sunBean1.setmPicUrl("http://i.imgur.com/CqmBjo5.jpg");
        listDatas.add(sunBean1);

        SunBean sunBean2 = new SunBean();
        sunBean2.setmTitle("房子2");
        sunBean2.setmPicUrl("http://i.imgur.com/zkaAooq.jpg");
        listDatas.add(sunBean2);


        SunBean sunBean3 = new SunBean();
        sunBean3.setmTitle("庆祝3");
        sunBean3.setmPicUrl("http://i.imgur.com/aFhEEby.jpg");
        listDatas.add(sunBean3);


        SunBean sunBean4 = new SunBean();
        sunBean4.setmTitle("另一半4");
        sunBean4.setmPicUrl("http://i.imgur.com/xZLIYFV.jpg");
        listDatas.add(sunBean4);

        SunBean sunBean5 = new SunBean();
        sunBean5.setmTitle("沙发5");
        sunBean5.setmPicUrl("http://i.imgur.com/jbemFzr.jpg");
        listDatas.add(sunBean5);

    }


}
